check_login()

window.onload = function() {

	getUserList(0).then(function(data) {
		showUserList(data);
	}).catch(function(error) {
		console.log(error);
	});
	
	showHead();
	showLeftMenu();
	
}


function showUserList(data){
	
	let list = $("#list");
	
	let trStr = '';	
	for(let i=0;i<data.length;i++){
		let sex;
;		if(data[i].sex == 1){
			sex = "男";
		}else{
			sex = "女";
		}
		trStr += `
				<tr>
					<td>
						<div class="form-check custom-checkbox checkbox-success check-lg me-3">
							<input type="checkbox" class="form-check-input" id="customCheckBox2" required="">
							<label class="form-check-label" for="customCheckBox2"></label>
						</div>
					</td>
					<td><strong>${data[i].account}</strong></td>
					<td><div class="d-flex align-items-center"><img src="static/picture/1.jpg" class="rounded-lg me-2" width="24" alt=""> <span class="w-space-no">${data[i].username}</span></div></td>
					<td>${data[i].email}</td>
					<td>${data[i].phone}</td>
					<td>${sex}</td>
					<td>${data[i].realName}</td>
					<td>${data[i].cardId}</td>
					<td>${data[i].createTime}</td>
					<td>${data[i].updateTIme}</td>
					<td><div class="d-flex align-items-center"><i class="fa fa-circle text-success me-1"></i> Successful</div></td>
					<td>
						<div class="d-flex">
							<a href="#" class="btn btn-primary shadow btn-xs sharp me-1"><i class="fa fa-pencil-alt"></i></a>
							<a href="#" class="btn btn-danger shadow btn-xs sharp"><i class="fa fa-trash"></i></a>
						</div>
					</td>
				</tr>`
	}
	list.html(trStr);
}
